package pers.zc.activiti.thread.demo;

import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service;

import java.util.concurrent.Future;

/**
 * @description future测试类2
 * @Author Lin FuYuan
 * @date 2020/4/17
 */
@Service
public class FutureClass2 {

    @Async("testThreadPool")
    public Future<Integer> test() {
        for (int i = 0; i <10 ; i++) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                System.out.println("InterruptedException异常");
                return new AsyncResult<>(1);
            }
            System.out.println("future2 "+i);
        }
        return new AsyncResult<>(1);
    }

    public static void main(String[] args) {
        String test = "export 都是防守打法是的= 倒萨发大水是=";
        String test2 = "export 的范德萨范德萨";
        String[] split = test.split("=");
        String[] split1 = test2.split("=");
        System.out.println(split.length);
        System.out.println(split1.length);
        System.out.println(test2.indexOf("="));
        System.out.println(test.substring("export ".length(),test.indexOf("=")));
    }

}
